const csr = @import("riscv").csr;

/// disable device interrupts
pub fn disable() bool {
    const sstatus = csr.readClear(.sstatus, .{ .sie = true });
    return sstatus.sie;
}

/// enable device interrupts
pub fn enable() void {
    csr.set(.sstatus, .{ .sie = true });
}

/// are device interrupts enabled?
pub fn get() bool {
    return csr.read(.sstatus).sie;
}
